# Makefile
# author: pgarcia@eside.deusto.es
CC=g++
LDFLAGS=-L../util -lm -lpthread -lesidesocket -lesidethread -lesidesqlite  
INCLUDE=-I../util


main: libesidedsm.so DsmServer mNameServer

libesidedsm.so: Dsm.o
	$(CC) -shared $(LDFLAGS) Dsm.o -o libesidedsm.so
	cp libesidedsm.so libesidedsm.dll
	
Dsm.o: Dsm.cc Dsm.h DsmTypes.h
	$(CC) $(INCLUDE) -c Dsm.cc
	
DsmServer: DsmServer.o
	$(CC)  DsmServer.o $(LDFLAGS) -o DsmServer

DsmServer.o: DsmServer.cc DsmServer.h DsmTypes.h
	$(CC) $(INCLUDE) -c DsmServer.cc

mNameServer: mNameServer.o libesidedsm.so
	$(CC) mNameServer.o libesidedsm.so $(LDFLAGS)  -o mNameServer

mNameServer.o: mNameServer.cc mNameServer.h
	$(CC) $(INCLUDE) -c mNameServer.cc
	

clean:
	rm *.o
	rm mNameServer
	rm *.exe
